package com.briup.day06;

public class Test_Triangle {
    public static void main(String[] args) {
        int[][] arr=new int[5][5];
        for (int i = 0; i < arr.length; i++) {
            for (int j = 0; j < arr[i].length; j++) {
                if(j==0){
                    arr[i][j]=1;
                }else if(i==j){
                    arr[i][j]=1;
                }else if(i>j){
                    arr[i][j]=arr[i-1][j-1]+arr[i-1][j];
                }
            }
        }
        for (int i = 0; i < arr.length; i++) {
            for (int k = arr.length-i; k >0; k--) {
                System.out.print(" ");
            }
            for (int j = 0; j <= i; j++) {
                System.out.print(arr[i][j]+" ");
            }
            System.out.println();
        }
    }

}
